import React from 'react';
import styles from './index.module.scss';

const SelectGroup = ({ children, value, onSelected, handleJumpToLast }) => {
  // selectedValue 表示当前外层是否有选择的值
  return (
    <div className={styles.selectGroup}>
      {React.Children.map(children, (child) => {
        return React.cloneElement(child, {
          selected: value === child.props.value,
          selectedValue: value,
          onSelected: onSelected,
          handleJumpToLast: handleJumpToLast,
        });
      })}
    </div>
  );
};

export default SelectGroup;
